@extends('layouts.default') @section('main')
<div id="content">
	<div id="content-header">
		<div id="breadcrumb">
			<a href="{{url('home')}}" title="返回首页" class="tip-bottom"><i
				class="icon-home"></i> 首页</a> <a href="{{url('role/index')}}"
				class="tip-bottom">角色管理</a> <a href="#" class="current">新增用户</a>
		</div>
	</div>
	<div class="container-fluid">
		<div class="row-fluid">
			<div class="span7">
				<div class="widget-box">
					<div class="widget-title">
						<span class="icon"> <i class="icon-align-justify"></i>
						</span>
						<h5>新增用户</h5>
					</div>
					<div class="widget-content nopadding">
						<form action="{{url('roleuser/insert')}}" method="post"
							class="form-horizontal" id="roleForm">
							<div class="control-group">
								<label class="control-label">用户昵称 :</label>
								<div class="controls">
									<input type="text" class="span11" name="nickname" placeholder="用户昵称" />
								</div>
							</div>
							<div class="control-group">
								<label class="control-label">用户账号 :</label>
								<div class="controls">
									<input type="text" class="span11" name="username" placeholder="用户账号" />
								</div>
							</div>
							<div class="control-group">
								<label class="control-label">密码 :</label>
								<div class="controls">
									<input type="password" class="span11" name="password" 	placeholder="密码" />
								</div>
							</div>
							<div class="control-group">
								<label class="control-label">确认密码 :</label>
								<div class="controls">
									<input type="password" class="span11" name="password2" placeholder="确认密码" />
								</div>
							</div>
							<div class="control-group">
								<label class="control-label">邮箱 :</label>
								<div class="controls">
									<input type="text" class="span11" name="email"
										placeholder="邮箱" />
								</div>
							</div>
							<div class="control-group">
								<label class="control-label">用户状态 :</label>
								<div class="controls">
									<label> <input type="radio" name="status" value="1" checked="checked" /> 开启
									</label> <label> <input type="radio" name="status" value="0" /> 禁用
									</label>
								</div>
							</div>
							<div class="form-actions">
								<button type="button" id="doSave" class="btn btn-success">保存</button>
							</div>
						</form>
					</div>
				</div>
			</div>
		</div>
	</div>
</div>
<script type="text/javascript" src="{{URL::asset('js/')}}/common.js"></script>
<script>
$("#doSave").click(function(){
    $(this).attr('disabled','disabled');

    ajaxRequest($('#roleForm').serializeArray(),$('#roleForm').attr('action'),function(data){
		if(data.status){
			window.location.href = data.forwardUrl;
		}else{
            $("#doSave").removeAttr('disabled');

            alert(data.message);
		}
	});
});
</script>
@stop
